package com.softstao.guoyu.mvp.presenter.sale;

import com.softstao.guoyu.model.sale.ProvinceRebateCondition;
import com.softstao.guoyu.model.sale.ProvinceRebateDetails;
import com.softstao.guoyu.model.sale.RetailCondition;
import com.softstao.guoyu.model.sale.RetailDetail;
import com.softstao.guoyu.model.sale.RetailList;
import com.softstao.guoyu.model.sale.SellByYears;
import com.softstao.guoyu.model.sale.YearsManage;
import com.softstao.guoyu.mvp.interactor.sale.RetailInteractor;
import com.softstao.guoyu.mvp.presenter.BasePresenter;
import com.softstao.guoyu.mvp.viewer.BaseViewer;
import com.softstao.guoyu.mvp.viewer.sale.AddRetailViewer;
import com.softstao.guoyu.mvp.viewer.sale.DeleteRetailViewer;
import com.softstao.guoyu.mvp.viewer.sale.ProvinceRebateDetailsViewer;
import com.softstao.guoyu.mvp.viewer.sale.RetailDetailViewer;
import com.softstao.guoyu.mvp.viewer.sale.RetailListViewer;
import com.softstao.guoyu.mvp.viewer.sale.SaleByYearsViewer;
import com.softstao.guoyu.mvp.viewer.sale.YearsManageViewer;

/**
 * Created by vaikus on 2017/7/19.
 */

public class RetailPresenter extends BasePresenter<BaseViewer,RetailInteractor> {
    public void getRetailList(int page, int agentId){
        interactor.getRetailList(page,agentId,o -> ((RetailListViewer)viewer).getRetailsList((RetailList) o));
    }

    public void getRetailDetail(int agentId, String retailOrderCode){
        interactor.getRetailDetail(agentId,retailOrderCode,o -> ((RetailDetailViewer)viewer).getRetailDetail((RetailDetail) o));
    }

    public void delete(int agentId, String retailOrderCode){
        interactor.delete(agentId,retailOrderCode,o -> ((DeleteRetailViewer)viewer).deleteResult(o));
    }

    public void addRetail(RetailCondition condition){
        interactor.addRetail(condition,o -> ((AddRetailViewer)viewer).addResult(o));
    }

    public void getSaleByYears(int agentId, String month){
        interactor.getSaleByYears(agentId, month, o -> ((SaleByYearsViewer)viewer).getSaleByYears((SellByYears) o));
    }

    public void getProvinceRebateDetails(int page, ProvinceRebateCondition condition){
        interactor.getProvinceRebateDetails(page, condition, o -> ((ProvinceRebateDetailsViewer)viewer).getRebates((ProvinceRebateDetails) o));
    }

    public void getMonthManageDetails(int page, int agentId, String month){
        interactor.getMonthManageDetails(page, agentId, month, o -> ((ProvinceRebateDetailsViewer)viewer).getMonthManage((ProvinceRebateDetails) o));
    }

    public void getYearsMonth(int agentId, String month){
        interactor.getYearsMonth(agentId, month, o -> ((YearsManageViewer)viewer).getYearsManage((YearsManage) o));
    }
}
